package com.ctsi.ssdc.admin.repository.oracle;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectKey;
import org.springframework.stereotype.Repository;

import com.ctsi.ssdc.admin.domain.CscpUserDetail;
import com.ctsi.ssdc.admin.repository.CscpUserDetailRepository;
import com.ctsi.ssdc.admin.repository.CscpUserDetailSqlProvider;

/**
 * @author lym
*/

public interface CscpUserDetailRepositoryForOracle extends CscpUserDetailRepository{
   
    @Insert({
        "insert into cscp_user_detail (id, user_id, family_name, ",
        "name, mobile, email, ",
        "img_path, last_login, ",
        "disc_title, disc_detail, ",
        "register_time)",
        "values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{familyName,jdbcType=VARCHAR}, ",
        "#{name,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, ",
        "#{imgPath,jdbcType=VARCHAR}, #{lastLogin,jdbcType=TIMESTAMP}, ",
        "#{discTitle,jdbcType=VARCHAR}, #{discDetail,jdbcType=VARCHAR}, ",
        "#{registerTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="select SEQ_CSCP_USER_ID.nextval as id from dual", keyProperty="id", before=true, resultType=Integer.class)
    int insert(CscpUserDetail record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_user_detail
     *
     * @mbg.generated Mon Apr 23 08:56:34 CST 2018
     */
    @InsertProvider(type=CscpUserDetailSqlProvider.class, method="insertSelective")
    @SelectKey(statement="select SEQ_CSCP_USER_ID.nextval as id from dual", keyProperty="id", before=true, resultType=Integer.class)
    int insertSelective(CscpUserDetail record);

}